<?php

/**
 * ContactVoyage filter form base class.
 *
 * @package    lointains-espace
 * @subpackage filter
 * @author     William Ong
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseContactVoyageFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'destination'   => new sfWidgetFormFilterInput(),
      'region'        => new sfWidgetFormFilterInput(),
      'date_depart'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'duree_voyage'  => new sfWidgetFormFilterInput(),
      'nombre_adulte' => new sfWidgetFormFilterInput(),
      'nombre_enfant' => new sfWidgetFormFilterInput(),
      'budget'        => new sfWidgetFormFilterInput(),
      'desc_projet'   => new sfWidgetFormFilterInput(),
      'civilite'      => new sfWidgetFormFilterInput(),
      'nom'           => new sfWidgetFormFilterInput(),
      'prenom'        => new sfWidgetFormFilterInput(),
      'adresse'       => new sfWidgetFormFilterInput(),
      'code_postal'   => new sfWidgetFormFilterInput(),
      'ville'         => new sfWidgetFormFilterInput(),
      'pays'          => new sfWidgetFormFilterInput(),
      'email'         => new sfWidgetFormFilterInput(),
      'telephone'     => new sfWidgetFormFilterInput(),
      'site_connu'    => new sfWidgetFormFilterInput(),
      'newsletter'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'destination'   => new sfValidatorPass(array('required' => false)),
      'region'        => new sfValidatorPass(array('required' => false)),
      'date_depart'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'duree_voyage'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nombre_adulte' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nombre_enfant' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'budget'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'desc_projet'   => new sfValidatorPass(array('required' => false)),
      'civilite'      => new sfValidatorPass(array('required' => false)),
      'nom'           => new sfValidatorPass(array('required' => false)),
      'prenom'        => new sfValidatorPass(array('required' => false)),
      'adresse'       => new sfValidatorPass(array('required' => false)),
      'code_postal'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ville'         => new sfValidatorPass(array('required' => false)),
      'pays'          => new sfValidatorPass(array('required' => false)),
      'email'         => new sfValidatorPass(array('required' => false)),
      'telephone'     => new sfValidatorPass(array('required' => false)),
      'site_connu'    => new sfValidatorPass(array('required' => false)),
      'newsletter'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('contact_voyage_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ContactVoyage';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'destination'   => 'Text',
      'region'        => 'Text',
      'date_depart'   => 'Date',
      'duree_voyage'  => 'Number',
      'nombre_adulte' => 'Number',
      'nombre_enfant' => 'Number',
      'budget'        => 'Number',
      'desc_projet'   => 'Text',
      'civilite'      => 'Text',
      'nom'           => 'Text',
      'prenom'        => 'Text',
      'adresse'       => 'Text',
      'code_postal'   => 'Number',
      'ville'         => 'Text',
      'pays'          => 'Text',
      'email'         => 'Text',
      'telephone'     => 'Text',
      'site_connu'    => 'Text',
      'newsletter'    => 'Boolean',
      'created_at'    => 'Date',
      'updated_at'    => 'Date',
    );
  }
}
